<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('迎新设置')" />
    <link th:href="@{/layui/css/layui.css}" rel="stylesheet" />
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
<!-- header -->
<div th:replace="~{commons/header::header}"></div>

<!-- left -->
    <div th:replace="~{commons/left::left}"></div>
<div class="layui-body">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="notice-form">
                <div class="select-list">
                    <ul>
                        <li>
                            姓名：<input type="text" name="stuName"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.addFull()" >
                <i class="fa fa-plus"></i> 新增
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.editFull()" >
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">
                <i class="fa fa-remove"></i> 删除
            </a>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var prefix = ctx + "common/man";
   console.log(ctx)
    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            modalName: "迎新",
            columns: [{
                checkbox: true
            },
                {
                    field: 'stuId',
                    title: '学号',
                    align: "center"
                },
                {
                    field: 'stuName',
                    title: '姓名',
                    align: "center"
                },
                {
                    field: 'stuImg',
                    title: '头像',
                    align: 'center',
                    formatter: function(value, row, index) {
                        console.log(value)
                        return $.table.imageView((value==null||value==""?ctx +'img/pitera.png':ctx+value.substr(1)));
                    }
                },
                {
                    field: 'stuPastName',
                    title: '曾用名',
                    align: "center"
                },
                {
                    field: 'stuSex',
                    title: '性别',
                    align: "center"

                },
                {
                    field: 'stuBirth',
                    title: '出生日期',
                    align: "center",
                },
                {
                    field: 'stuIdCard',
                    title: '身份证',
                    align: "center"
                },
                {
                    field: 'stuProvince',
                    title: '籍贯',
                    align: "center"
                },
                {
                    field: 'stuCountry',
                    title: '国籍',
                    align: "center"
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs  " href="javascript:void(0)" onclick="$.operate.editFull(\'' + row.stuId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs " href="javascript:void(0)" onclick="$.operate.remove(\'' + row.stuId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }

            ]
        };
        $.table.init(options);
    });

</script>
</body>
</html>